package com.review.aop.common.util;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.util.StringUtils;

import java.util.Map;

public class JwtUtil {

    public static String createToken(Map<String,Object> claims,String secret){
        String token = Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS256, secret).compact();
        return token;
    }

    public static Claims parseToken(String token, String secret){
        return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody();
    }

}
